import { ImgTabBarItem } from "../../../../../component/imgTabbar/ImgTabBarItem";
import { GlobalStyle } from "../../../../../common/global/GlobalStyle";
import { ImageInfo } from "../../../../../../com/gengine/resource/info/ImageInfo";
import { LoaderManager } from "../../../../../../com/gengine/resource/LoaderManager";
import { ResouceConst } from "../../../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../../../resource/ImagesConst";
import { GlobalClass } from "../../../../../../com/mui/core/GlobalClass";
import { GTextFormat } from "../../../../../common/GTextFormat";
import { FilterConst } from "../../../../../component/gconst/FilterConst";
import { DailySpecialCodeInfo } from "../../../../model/DailySpecialCodeInfo";
import { ScaleBitmap } from "../../../../../../com/mui/display/ScaleBitmap";
type int = number;
//class IconBtn
    
    export  class IconBtn extends ImgTabBarItem
    {
        constructor()
        {
            super();
            upColor = GlobalStyle.color1Uint;
            return;
        }

        /* internal  */onIconLoadedHandler(arg1: ImageInfo): void
        {
            if (arg1 && arg1.bitmapData) 
            {
                this._iconBmp.bitmapData = arg1.bitmapData;
            }
            return;
        }

        /* internal  */onIconLoadedFailed(arg1): void
        {
            LoaderManager.instance.load("0000000000.jpg", this.onIconLoadedHandler, 3, null, null, this.onIconLoadedFailed);
            return;
        }

        protected /* override */ initUI(): void
        {
            this._border = ResouceConst.getScaleBitmap(ImagesConst.PackItemBg);
            this._border.width = 66;
            this._border.height = 66;
            this._border.x = 5;
            this._border.y = 0;
            addChild(this._border);
            this._iconBmp = new Object /* flash.display.Bitmap */();
            this._iconBmp.x = this._border.x + 3;
            this._iconBmp.y = this._border.y + 3;
            addChild(this._iconBmp);
            _upBg = GlobalClass.getScaleBitmap(ImagesConst.IconBtn_upSkin, new Object /* flash.geom.Rectangle */(10, 24, 2, 2));
            _upBg.width = 106;
            _upBg.x = this._border.x + this._border.width;
            _upBg.y = this._border.y + (this._border.height - _upBg.height) / 2;
            _overBg = GlobalClass.getScaleBitmap(ImagesConst.IconBtn_overSkin, new Object /* flash.geom.Rectangle */(10, 24, 2, 2));
            _overBg.width = 106;
            _overBg.x = _upBg.x;
            _overBg.y = _upBg.y;
            var loc1=new GTextFormat("", 12, GlobalStyle.color1Uint);
            loc1.leading = 4;
            _titleText = new Object /* flash.text.TextField */();
            _titleText.autoSize = flash.text.TextFieldAutoSize.LEFT;
            _titleText.defaultTextFormat = loc1;
            _titleText.mouseEnabled = false;
            _titleText.wordWrap = true;
            _titleText.multiline = true;
            _titleText.textColor = _upColor;
            _titleText.filters = [FilterConst.nameGlowFilter];
            _titleText.width = 70;
            _titleText.height = 40;
            _titleText.x = _upBg.x + 4;
            _titleText.y = _upBg.y + 6;
            addChild(_titleText);
            this._indexTxt = new Object /* flash.text.TextField */();
            this._indexTxt.mouseEnabled = false;
            this._indexTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
            this._indexTxt.textColor = 65280;
            this._indexTxt.filters = [FilterConst.nameGlowFilter];
            this._indexTxt.width = 20;
            this._indexTxt.height = 20;
            this._indexTxt.x = _upBg.x + 89;
            this._indexTxt.y = _upBg.y + 15;
            addChild(this._indexTxt);
            selected(false);
            return;
        }

        public /* override */ set index(arg1: int)
        {
            super.index = arg1;
            this._indexTxt.text = arg1.toString();
            return;
        }

        public /* override */ updateData(arg1: Object): void
        {
            super.updateData(arg1);
            this._actInfo = arg1 as DailySpecialCodeInfo;
            _titleText.text = this._actInfo.label;
            LoaderManager.instance.load(100000000000 + this._actInfo.type + ".jpg", this.onIconLoadedHandler, 3, null, null, this.onIconLoadedFailed);
            return;
        }

        /* internal */ /* var */_border: ScaleBitmap;

        /* internal */ /* var */_iconBmp: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_indexTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_actInfo: DailySpecialCodeInfo;
    }
